<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Title</title>
    </head>
    <body>

        <script type="text/javascript">

            //利用location对象，修改浏览器地址栏中的url
            location.href="http://www.baidu.com";


            //利用location对象，获取当前浏览器中的地址栏的URL
            var currentUrl = window.location.href;
            console.log("当前地址栏中的URL = " + currentUrl);

        </script>

    </body>
</html>